<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > 
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:s="http://jboss.com/products/seam/taglib"
	  xmlns:c="http://java.sun.com/jstl/core"
	  xmlns:rich="http://richfaces.org/rich"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	  xmlns:a4j="http://richfaces.org/a4j" 
	  xmlns:kiwi="http://www.kiwi-project.eu/jsf"  	
	  xmlns:a="http://richfaces.org/a4j" > 
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <title>KiWi Query Builder</title>
		
		<link rel="stylesheet" href="KQB.css" type="text/css" />
		<s:remote include="KQBAction"/>
		<script src="KQB.js" type="text/javascript"></script>
		<script src="KQBNode.js" type="text/javascript"></script>
		<script src="KQBDragDrop.js" type="text/javascript"></script>
		<script src="KQBUtilities.js" type="text/javascript"></script>
		<script src="KQBStrings_En.js" type="text/javascript"></script>
		<script type="text/javascript" src="antlr3-all.js"></script> 
		<script type="text/javascript" src="KWQLLexer.js"></script> 
		<script type="text/javascript" src="KWQLParser.js"></script> 
	<link rel="shortcut icon" href="KQB2.xhtml#{facesContext.externalContext.requestContextPath}/favicon.ico" type="image/x-icon" />
	    <script src="/KiWi/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js" type="text/javascript"></script><script src="/KiWi/a4j/g/3_3_1.GA/org/richfaces/ui.pack.js" type="text/javascript"></script><link class="component" href="/KiWi/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELtGZfH7p8hjQADFYC8g__" rel="stylesheet" type="text/css" /><link class="component" href="/KiWi/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELtGZfH7p8hjQADFYC8g__" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><link class="component" href="/KiWi/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/css/msg.css" rel="stylesheet" type="text/css" /><link class="component" href="/KiWi/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/css/msgs.css" rel="stylesheet" type="text/css" /><link class="component" href="/KiWi/a4j/s/3_3_1.GAcss/inplaceselect.xcss/DATB/eAELtGZfH7p8hjQADFYC8g__" rel="stylesheet" type="text/css" /><script id="org.ajax4jsf.queue_script" type="text/javascript">if (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {if (!EventQueue.getQueue('formHdrSearch')) { EventQueue.addQueue(new EventQueue('formHdrSearch',null,null)) };if (!EventQueue.getQueue('formHdrNavigation')) { EventQueue.addQueue(new EventQueue('formHdrNavigation',null,null)) };if (!EventQueue.getQueue('org.richfaces.queue.global')) { EventQueue.addQueue(new EventQueue('org.richfaces.queue.global',null,null)) };}}};</script><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>     
    <body onload="KQB.Init()">
        <div id="globalStatusDiv" style="display:none;">
        <!-- image generated by http://ajaxload.info/ -->
        <img src="img/ajax-loader.gif" alt="Loading" />&#160;Loading...
    </div>
    
    
    <a4j:status
        onstart="jQuery('#globalStatusDiv').fadeIn('fast')"
        onstop="jQuery('#globalStatusDiv').fadeOut('slow')"
    />
       
    <div id="wrap">
    
    <div id="header">

	    <div id="logo">
		    <s:link view="/home.xhtml">
		        <f:param name="title" />
	            <f:param name="uri" value="#{configurationService.startPage}"/>
	            <f:param name="id" />
	            <f:param name="kiwiid"/>
	            <img src="KQB2.xhtml#{facesContext.externalContext.requestContextPath}/img/kiwi_logo.png" alt="KiWi Logo" />
	        </s:link>	    
	   </div>
	    <div id="mainnav">
	        <h:form id="formHdrApplications">
		        <ul>
		            <ui:repeat value="#{kiwi.ui.headerAction.applications}" var="app">
		            	<li>
		                    <h:commandLink action="#{kiwi.ui.headerAction.switchApplication(app)}" rendered="#{kiwi.ui.headerAction.isVisible(app)}">
		                        <span class="mainnav_title"><h:outputText value="#{app.name}" /></span>
		                        <span class="mainnav_subtitle"><h:outputText value="#{messages[fn:join(fn:join('app.',app.identifier),'.description')]}"/></span>
		                    </h:commandLink>
		                </li>
		            </ui:repeat>
		        </ul>   
	        </h:form>
	    </div>
	    <div id="searchbox">
	       <h:form id="formHdrSearch">
	           <a4j:queue />
	           <!--BEGIN: interedu hack -->
	           <s:fragment rendered="#{currentApplication.identifier ne 'interedu'}">
		       <h:inputText id="hdrSearchBox" value="#{searchAction.searchQuery}"/>
		       <!-- 
               <rich:suggestionbox for="hdrSearchBox" suggestionAction="#{searchAction.autocomplete}" var="result" >
               <h:column>
                    <h:outputText value="#{result}" />
               </h:column>
               </rich:suggestionbox>	          
               -->
               <a4j:commandButton id="hdrSearchBtn" action="#{searchAction.getSearchView()}"  style="border: 0" image="/img/search.png" value="#{messages['hdr.search']}" type="submit">
	               <s:defaultAction/>
	           </a4j:commandButton>
	           
	           </s:fragment>
	           <!-- 
	           <s:fragment rendered="#{currentApplication.identifier eq 'interedu'}">
	           		       <h:inputText id="hdrIntereduSearchBox" value="#{interedu.searchAction.searchQuery}"/>
               <a4j:commandButton id="hdrIntereduSearchBtn" action="#{interedu.searchAction.getSearchView()}" style="border: 0" image="/img/search.png" value="#{messages['hdr.search']}" type="submit">
	               <s:defaultAction/>
	           </a4j:commandButton>
	           </s:fragment>
	           -->
	        
	       <br/>    
		           <!-- END: interedu hack -->
           </h:form>
           
			<h:commandButton value="Erweiterte Suche" id = 'intereduExtendedSearch' rendered="#{currentApplication.identifier eq 'interedu'}">
	           <rich:componentControl for="intereduExtendedSearchPanel"
							attachTo="intereduExtendedSearch" operation="show" event="onclick" />
	        </h:commandButton>
	       
	    </div>
    </div>

    <div id="navbar">
        <h:form id="formHdrNavigation">
            <a4j:queue/>
		    <div id="history">
		        <ui:insert name="actions"/>
		    
		        <h:outputText value="History: " />
		        <c:forEach items="#{kiwi.ui.historyAction.lastItems}" var="item" varStatus="status">
		            <h:outputText value=" - " rendered="#{not status.first}"/>
		            <kiwi:link contentItem="#{item}" value="#{kiwi.ui.historyAction.ellipseString(item.title)}"/>
		        </c:forEach>
		    </div>
		    <div id="user">
		    
		    
	            <h:outputText value="#{messages['hdr.welcome']}, #{currentUser.firstName} #{currentUser.lastName}!"
	                       rendered="#{not (currentUser.login eq 'anonymous') }" />
            
                <s:fragment rendered="#{currentUser.login eq 'anonymous'}">
		            <s:link action="login" 
		                     value="#{messages['hdr.login']}" />
                </s:fragment>	
                                    
	            <h:outputText value=" - " />
	
	            <s:link action="register" 
	                     value="#{messages['hdr.signup']}"
	                  rendered="#{currentUser.login eq 'anonymous'}" />
	        
	            <s:link action="#{identityManagerService.logout}" 
	                     value="#{messages['hdr.logout']}"
	                  rendered="#{not (currentUser.login eq 'anonymous')}" />   			
				<!-- status messages -->
				<div id="status">
	       			<b>bla</b>
				</div>
				<script src="KQB2.xhtml#{facesContext.externalContext.requestContextPath}/widgets/status/widget.status.js" type="text/javascript"></script>
   				<script>
   					jQuery(document).ready(function(){
						jQuery('#status').status({
							webServiceUrl: '#{facesContext.externalContext.requestContextPath}/seam/resource/services/widgets/status',
							frequence: 5000,
							img_running: '#{facesContext.externalContext.requestContextPath}/img/status-running.gif',
							img_stopped: '#{facesContext.externalContext.requestContextPath}/img/status-stopped.gif'
						});
					});
				</script>
		    </div>
	    </h:form>
	</div>
    
           <div id="content">
            <div id="content_1column" class="roundedBox">           
	
<noscript>
			
			<div style="background-color:red; color:white; margin: 10px; padding: 10px; font-size:20px; width:70%;">
			Welcome to the KiWi Query Builder. 
			The KQB is a DHTML application using JavaScript.
			JavaScript is currently disabled in Your browser. 
			To use the KQB, please enable the execution of scripts for this page
			</div>
			
		</noscript>
	
		<ul id="menulevel1">
	
		<li><a href="KQB2.xhtml#">Resources</a>
			<ul class="menulevel2">
				<li><a href="KQB2.xhtml#" title="ContentItem" alt="test" onclick="KQB.NewNode(KQB.NodeType.ContentItem); return false;">content item</a></li>
				<li><a href="KQB2.xhtml#" title="Fragment" onclick="KQB.NewNode(KQB.NodeType.Fragment); return false;">fragment</a></li>
				<li><a href="KQB2.xhtml#" title="Link" onclick="KQB.NewNode(KQB.NodeType.Link); return false;">link</a></li>
				<li><a href="KQB2.xhtml#" title="Tag" onclick="KQB.NewNode(KQB.NodeType.Tag); return false;">tag</a></li>
			</ul>
		</li>
	
		<li><a href="KQB2.xhtml#">Qualifiers</a>
			<ul class="menulevel2">
				<li><a href="KQB2.xhtml#">content item<span>&raquo;</span></a>
					<ul class="menulevel3">
						<li><a href="KQB2.xhtml#" title="Author" onclick="KQB.NewNode(KQB.NodeType.Author); return false;">author</a></li>
						<li><a href="KQB2.xhtml#" title="Child" onclick="KQB.NewNode(KQB.NodeType.Child); return false;">child</a></li>
						<li><a href="KQB2.xhtml#" title="Created" onclick="KQB.NewNode(KQB.NodeType.Created); return false;">created</a></li>
						<li><a href="KQB2.xhtml#" title="Descendant" onclick="KQB.NewNode(KQB.NodeType.Descendant); return false;">descendant</a></li>
						<li><a href="KQB2.xhtml#" title="Agree" onclick="KQB.NewNode(KQB.NodeType.Agree); return false;">agree</a></li>
						<li><a href="KQB2.xhtml#" title="Disagree" onclick="KQB.NewNode(KQB.NodeType.Disagree); return false;">disagree</a></li>
						<li><a href="KQB2.xhtml#" title="Fragment" onclick="KQB.NewNode(KQB.NodeType.Fragment); return false;">fragment</a></li>
						<li><a href="KQB2.xhtml#" title="LastEdited" onclick="KQB.NewNode(KQB.NodeType.LastEdited); return false;">lastEdited</a></li>
						<li><a href="KQB2.xhtml#" title="Link" onclick="KQB.NewNode(KQB.NodeType.Link); return false;">link</a></li>
						<li><a href="KQB2.xhtml#" title="NumberEdits" onclick="KQB.NewNode(KQB.NodeType.NumberEdits); return false;">numberEdits</a></li>
						<li><a href="KQB2.xhtml#" title="Tag" onclick="KQB.NewNode(KQB.NodeType.Tag); return false;">tag</a></li>
						<li><a href="KQB2.xhtml#" title="Text" onclick="KQB.NewNode(KQB.NodeType.Text); return false;">text</a></li>
						<li><a href="KQB2.xhtml#" title="Title" onclick="KQB.NewNode(KQB.NodeType.Title); return false;">title</a></li>
						<li><a href="KQB2.xhtml#" title="URI" onclick="KQB.NewNode(KQB.NodeType.URI); return false;">URI</a></li>
					</ul>
				</li>
				<li><a href="KQB2.xhtml#">fragment<span>&raquo;</span></a>
					<ul class="menulevel3">
						<li><a href="KQB2.xhtml#" title="Author" onclick="KQB.NewNode(KQB.NodeType.Author); return false;">author</a></li>
						<li><a href="KQB2.xhtml#" title="Child" onclick="KQB.NewNode(KQB.NodeType.Child); return false;">child</a></li>
						<li><a href="KQB2.xhtml#" title="Created" onclick="KQB.NewNode(KQB.NodeType.Created); return false;">created</a></li>
						<li><a href="KQB2.xhtml#" title="Descendant" onclick="KQB.NewNode(KQB.NodeType.Descendant); return false;">descendant</a></li>
						<li><a href="KQB2.xhtml#" title="Tag" onclick="KQB.NewNode(KQB.NodeType.Tag); return false;">tag</a></li>
						<li><a href="KQB2.xhtml#" title="URI" onclick="KQB.NewNode(KQB.NodeType.URI); return false;">URI</a></li>
					</ul>
				</li>
				<li><a href="KQB2.xhtml#">link<span>&raquo;</span></a>
					<ul class="menulevel3">
						<li><a href="KQB2.xhtml#" title="AnchorText" onclick="KQB.NewNode(KQB.NodeType.AnchorText); return false;">anchor text</a></li>
						<li><a href="KQB2.xhtml#" title="Tag" onclick="KQB.NewNode(KQB.NodeType.Tag); return false;">tag</a></li>
						<li><a href="KQB2.xhtml#" title="Target" onclick="KQB.NewNode(KQB.NodeType.Target); return false;">target</a></li>
					</ul>
				</li>
				<li><a href="KQB2.xhtml#">tag<span>&raquo;</span></a>
					<ul class="menulevel3">
						<li><a href="KQB2.xhtml#" title="Author" onclick="KQB.NewNode(KQB.NodeType.Author); return false;">author</a></li>
						<li><a href="KQB2.xhtml#" title="Created" onclick="KQB.NewNode(KQB.NodeType.Created); return false;">created</a></li>
						<li><a href="KQB2.xhtml#" title="Disagree" onclick="KQB.NewNode(KQB.NodeType.Disagree); return false;">disagree</a></li>
						<li><a href="KQB2.xhtml#" title="Name" onclick="KQB.NewNode(KQB.NodeType.Name); return false;">name</a></li>
						<li><a href="KQB2.xhtml#" title="URI" onclick="KQB.NewNode(KQB.NodeType.URI); return false;">URI</a></li>
					</ul>
				</li>
			</ul>
		</li>
		

		<li><a href="KQB2.xhtml#">Operators</a>
			<ul class="menulevel2">
				<li><a href="KQB2.xhtml#" title="AND" onclick="KQB.NewNode(KQB.NodeType.AND); return false;">AND</a></li>
				<li><a href="KQB2.xhtml#" title="OR" onclick="KQB.NewNode(KQB.NodeType.OR); return false;">OR</a></li>
				<li><a href="KQB2.xhtml#" title="NOT" onclick="KQB.NewNode(KQB.NodeType.NOT); return false;">NOT</a></li>
				<li><a href="KQB2.xhtml#" title="OPTIONAL" onclick="KQB.NewNode(KQB.NodeType.OPTIONAL); return false;">OPTIONAL</a></li>
				<li><a href="KQB2.xhtml#" title="ALL" onclick="KQB.NewNode(KQB.NodeType.ALL); return false;">ALL</a></li>
				<li><a href="KQB2.xhtml#" title="SOME" onclick="KQB.NewNode(KQB.NodeType.SOME); return false;">SOME</a></li>
				<li><a href="KQB2.xhtml#" title="COUNT" onclick="KQB.NewNode(KQB.NodeType.COUNT); return false;">COUNT</a></li>
			</ul>
		</li>
		
		<li><a href="KQB2.xhtml#">Other</a>
			<ul class="menulevel2">
				<li><a href="KQB2.xhtml#" title="Keyword" onclick="KQB.NewNode(KQB.NodeType.Keyword); return false;">Value</a></li>
				<li><a href="KQB2.xhtml#" title="Variable" onclick="KQB.NewNode(KQB.NodeType.Variable); return false;">Variable</a></li>
				<li><a href="KQB2.xhtml#" title="Binding" onclick="KQB.NewNode(KQB.NodeType.Binding); return false;">Binding</a></li>
				<li><a href="KQB2.xhtml#" title="Compound" onclick="KQB.NewNode(KQB.NodeType.Compound); return false;">Compound</a></li>
				<li><a href="KQB2.xhtml#" title="Rule" onclick="KQB.NewNode(KQB.NodeType.Rule); return false;">Rule</a></li>
				<li><a href="KQB2.xhtml#" title="SPARQL" onclick="KQB.NewNode(KQB.NodeType.SPARQL); return false;">SPARQL</a></li>
			</ul>
		</li>
		
		<li><a href="KQB2.xhtml#">Examples</a>
			<ul class="menulevel2">
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(1); return false;" title="Search for wiki pages with 'KiWi' in the title and 'KWQL' somewhere in the text">Example 1</a></li>
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(2); return false;" title="Search for wiki pages which are tagged 'KiWi' or have a child-page tagged 'KWQL'">Example 2</a></li>
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(3);return false;" title="Search for wiki pages that contain the word 'KiWi' and do not contain the word 'KWQL'">Example 3</a></li>
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(4);return false;" title="Get the number of tags that were given to wiki pages">Example 4</a></li>
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(5);return false;" title="Get the number of tags that were given to wiki pages">Example 5</a></li>
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(6);return false;" title="Get the number of tags that were given to wiki pages">Example 6</a></li>
				<li><a href="KQB2.xhtml#" onclick="KQB.Example(7);return false;" title="Get the number of tags that were given to wiki pages">Example 7</a></li>
			</ul>
		</li>
		
	</ul>
		
		<table id="toppanel" style="width:75%">
		    <tr>
			<td>
			    <button onclick="KQB.Undo()">UNDO</button>
			    <button onclick="KQB.Redo()">REDO</button>
			</td>
			<td style="text-align:right;">
			    Saved Queries:
			    <select id="KQBSavedQueriesBox" style="width:200px"></select>
			    <button onclick="KQB.LoadSavedQuery()">Load</button>
			    <button onclick="KQB.DeleteSavedQuery()">Delete</button>
			    <button onclick="KQB.SaveCurrentQuery()">Save current query</button>
			</td>
		    </tr>
		</table>
		<div id="workspace"></div>
		<div id="tooltippane"></div>
		<div id="hintarea" style="width:75%; height:30px">
		    <span id="hintpane"></span>
		    <span id="resizearea"></span>
		</div> 
		 
		<table id="outputtable" style="clear:both;">
			<tr>
				<td class="left">KWQL:</td>
				<td style="width:40%">
				    <textarea id="outputpane" rows="5" style="width:97%"></textarea>
				</td>
				<td>
				    <table>
					<tr>
					    <td>
						<button onclick="var inputstring = KQB.Outputpane.value;
						    if ( (inputstring.length == 0) || (KQB.ErrorNodes.length>0))
						    {
							alert ('Invalid query');
							return;
						    }
						    document.getElementById('kwqlSearchbarForm:searchField').value = inputstring;
						    document.getElementById('kwqlSearchbarForm:kwqlSearchbarButton').click();
						    ">
						    
						    Execute Query</button>
					    </td>
					</tr>
					<tr>
					    <td>
						<button onclick="KQB.Parse()">Parse Query</button>
					    </td>
					</tr>
					<tr>
					    <td>
						<button onclick="KQB.Clear()">Clear Workspace</button>
					    </td>
					</tr>
				    </table>
				    
				</td>
				<td>
				    <span id="parsererrorpane" style="color:red;"></span>				    
				</td>
			</tr>
		</table>
		<h:form id="kwqlSearchbarForm">
                <div id="searchbar">
	                    <h:inputHidden value="#{kwqlAction.searchEngine.KWQLQuery}" id="searchField"/>
	                    <!-- 
	                    <rich:suggestionbox for="searchField" suggestionAction="#{kwqlaAction.searchEngine.autocomplete}" var="result">
		                    <h:column>
		                        <h:outputText value="#{result}" />
		                    </h:column>
	                    </rich:suggestionbox>
	                    -->
	                    <a:commandButton 
	                        action="#{kwqlAction.searchEngine.runSearch()}"
	                        
id="kwqlSearchbarButton" size="1" 
	                        value=" "
	                        image="#{facesContext.externalContext.requestContextPath}/spacer.gif" 
	                        reRender="#{kwqlAction.renderedSearchPageParts()}"
	                    />

    
	           </div>
           
				<div id="search_numberofresults">
					<s:span id="nrOfResults">
						<s:span rendered="#{kwqlAction.searchEngine.searchResults.resultCount>1}">
							Results #{(kwqlAction.searchEngine.page-1) * kwqlAction.searchEngine.pageSize + 1} - 
							#{kwqlAction.searchEngine.min(kwqlAction.searchEngine.searchResults.resultCount, (kwqlAction.searchEngine.page * kwqlAction.searchEngine.pageSize))}
							out of #{kwqlAction.searchEngine.searchResults.resultCount} total.
						</s:span>
						<s:span rendered="#{1 eq kwqlAction.searchEngine.searchResults.resultCount }">
							#{kwqlAction.searchEngine.searchResults.resultCount} result found.
						</s:span>
						<s:span rendered="#{0 eq kwqlAction.searchEngine.searchResults.resultCount and kwqlAction.searchEngine.KWQLQuery.length() > 0}">
							No results found.
						</s:span>
						<br/>
					</s:span>
				</div>
				<div id="search_view_sort">
					  <h:outputText value="Personalized Search"/>
	                    <h:selectBooleanCheckbox title="Sign in, tag and search" value="#{kwqlAction.searchEngine.personalSearch}" id="checkboxID">
        					<a:support id="checkboxSupport" event="onchange" reRender="#{kwqlAction.renderedSearchPageParts()}" />
						</h:selectBooleanCheckbox>
	           		View: 
	           		<rich:inplaceSelect id="searchviewmode" value="#{kiwi.wiki.ui.layoutAction.viewMode}"
	        			defaultLabel="Click here to edit">
		           		<a:support event="onviewactivated" 
		           			actionListener="#{kwqlAction.searchEngine.getResults(false)}" 
		           			reRender="searchviewmode,searchresults" />
		           		<s:selectItems value="#{kiwi.wiki.ui.layoutAction.viewModes}" var="mode" label="#{mode}"/>
	        		</rich:inplaceSelect>
	        		
					Sort by:
					<rich:inplaceSelect id="searchorderby" value="#{kwqlAction.searchEngine.orderBy}"
	        			defaultLabel="Click here to edit">
						<a:support event="onviewactivated" 
							action="#{kwqlAction.searchEngine.getResults(true)}" 
							reRender="searchorderby,searchresults"/>
		           		<s:selectItems value="#{kwqlAction.searchEngine.orderBys}" var="orderBy" label="#{orderBy}"/>
		           	</rich:inplaceSelect>
					<h:outputText value=" "/>
					<rich:inplaceSelect id="searchorder" value="#{kwqlAction.searchEngine.order}"
	        			defaultLabel="Click here to edit">
						<a:support event="onviewactivated" 
							action="#{kwqlAction.searchEngine.getResults(true)}" 
							reRender="searchorder,searchresults"/>
		           		<s:selectItems value="#{kwqlAction.searchEngine.orders}" var="order" label="#{kiwi.messages.getProperty(order)}"/>
		           	</rich:inplaceSelect>
				</div>
				<br/>

				<!--  the search results in the left column -->
<s:div id="searchresults" style="clear:left;">
					<c:forEach items="#{kwqlAction.searchEngine.currentResults.results}" var="r" >
						<hr style="clear:both;"/>
						<!-- include template to show one result item. -->
						<ui:include src="KQB2.xhtml#{kiwi.wiki.ui.layoutAction.getSearchResultItemTemplate(r.item)}">
							<ui:param name="ci" value="#{r.item}" />
							<ui:param name="mode" value="#{kiwi.wiki.ui.layoutAction.viewMode}" />
							<ui:param name="score" value="#{r.score}" />
							<ui:param name="ceq" value="#{r.ceq}" />
							<ui:param name="preview" value="#{kwqlAction.searchEngine.getPreview(r.item)}"/>
						</ui:include>
						<br/>
					</c:forEach> 
				</s:div>
				
			
				<s:div id="resultNavigation">
				   <!-- result navigation -->
				    <c:if test="${kwqlAction.searchEngine.pages.size>1}">
	               <table width="100%">
	                   <tr>
	                       <td width="20%">
	                           <a:commandButton action="#{kwqlAction.searchEngine.prevPage()}" 
	                           		value="previous page" 
	                           		reRender="#{kwqlAction.renderedSearchPageParts()}" 
	                           		disabled="#{kwqlAction.searchEngine.page eq 1}"/>
	                       </td>
	                       <td style="text-align: center; font-size: 140%;">
                       		   <c:forEach items="#{kwqlAction.searchEngine.pages}" var="page">
	                            	<s:span rendered="#{ page eq 1 and kwqlAction.searchEngine.page > 5 }">
	                            		<a:commandLink action="#{kwqlAction.searchEngine.setPage(page)}" 
	                            			value="#{page}" 
	                            			reRender="#{kwqlAction.renderedSearchPageParts()}" />
	                            		<h:outputText value=" ... " />	                            	
	                            	</s:span>

	                            	<s:span rendered="#{page eq kwqlAction.searchEngine.page}">
	                            		<strong>
			                            	<h:outputText value="#{page}"/>
			                            </strong>
	                            	</s:span>
	                            	
	                            	<s:span rendered="#{ (page eq kwqlAction.searchEngine.pages.size) and ((page-kwqlAction.searchEngine.page) > 5) }">
	                            		<h:outputText value=" ... " />	                            	
	                            		<a:commandLink action="#{kwqlAction.searchEngine.setPage(page)}" 
	                            			value="#{page}" 
	                            			reRender="#{kwqlAction.renderedSearchPageParts()}" />
	                            	</s:span>

	                            	<s:span rendered="#{(page != kwqlAction.searchEngine.page) and (5 > page - kwqlAction.searchEngine.page) and (page - kwqlAction.searchEngine.page > -5) }">
	                            		<a:commandLink action="#{kwqlAction.searchEngine.setPage(page)}" 
	                            			value="#{page}" 
	                            			reRender="#{kwqlAction.renderedSearchPageParts()}" />
	                            	</s:span>
	                           		
	                           		<h:outputText value=" " />
	                           </c:forEach>
	                       </td>
	                       <td style="text-align: right" width="20%">
	                           <a:commandButton action="#{kwqlAction.searchEngine.nextPage()}" 
	                           		value="next page" 
	                           		reRender="#{kwqlAction.renderedSearchPageParts()}" 
	                           		disabled="#{kwqlAction.searchEngine.page eq kwqlAction.searchEngine.pages.size}"/>
	                       </td>    
	                   </tr>
	               </table>
	               </c:if>
				</s:div>
			</h:form>	
			</div>
			</div>
		<div id="footer">
		Powered by <a href="http://www.kiwi-project.eu">KiWi - Knowledge in a Wiki</a> (version @version@).
	</div>	
	</div>
    </body>
</ui:composition>   
